<?php
/**
 * WebCms plugin
 * 
 * @package Smarty
 * @subpackage PluginsFunction
 */

/**
 * Smarty {call_func} function plugin
 * 
 * Type:     function<br>
 * Name:     call_func<br>
 * Purpose:  call one function from tpl<br>
 * 
 * 
 * Examples:
 * <pre>
 * {call_func fname='function' a='company'*}
 * </pre>
 * 
 * @author Sérgio 'Horizak' Alves <sergioalves87@gmail.com> 
 * @version 1
 * @param array $params parameters
 * Input:<br>
 *          - loop = array whith params
 * @param object $smarty Smarty object
 * @param object $template template object
 * @return string 
 */
function smarty_function_call_func() {
  global $cms;
  $args = func_get_args();
  if(function_exists($args[0]['fname'])) return $args[0]['fname']($args[0]);
  else cms_error(100,'Plugin call_func : Function does not exist: '.$args[0]['fname']);
}
?>
